package com.neusoft.bizcore.activiti.model;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.Table;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;

import org.hibernate.validator.constraints.Length;

import com.neusoft.bizcore.activiti.enums.WorkOrderStatus;
import com.neusoft.bizcore.web.jpa.model.AbstractAuditModel;
import com.neusoft.bizcore.web.jpa.model.Comment;

import lombok.Getter;
import lombok.Setter;
import lombok.ToString;

@Getter
@Setter
@ToString
@Entity
@org.hibernate.annotations.Table(appliesTo = "wf_work_order", comment = "流程工单表")
@Table(name = "wf_work_order")
public class WorkOrder extends AbstractAuditModel {

    private static final long serialVersionUID = 1L;

    /** 申请人名称 */
    @NotBlank(message = "申请人名称不能为空")
    @Length(max = 255, message = "申请人名称不能超过{max}位")
    @Column(length = 255, nullable = false)
    @Comment("varchar(255) NOT NULL COMMENT '申请人名称'")
    private String applyUserName;

    /** 申请人编码 */
    @NotBlank(message = "申请人编码不能为空")
    @Length(max = 255, message = "申请人编码不能超过{max}位")
    @Column(length = 255, nullable = false)
    @Comment("varchar(255) NOT NULL COMMENT '申请人编码'")
    private String applyUserId;

    /** 流程标题 */
    @NotBlank(message = "流程标题不能为空")
    @Length(max = 255, message = "流程标题不能超过{max}位")
    @Column(length = 255, nullable = false)
    @Comment("varchar(255) NOT NULL COMMENT '流程标题'")
    private String title;

    /** 流程实例ID */
    @Length(max = 255, message = "流程实例ID不能超过{max}位")
    @Column(length = 255, nullable = true)
    @Comment("varchar(255) NULL DEFAULT NULL COMMENT '流程实例ID'")
    private String instanceId;

    /** 工单类型 */
    @NotNull(message = "工单类型不能为空")
    @Comment("varchar(255) NOT NULL COMMENT '工单类型'")
    private String type;

    /** 工单号 */
    @Length(max = 255, message = "工单号不能超过{max}位")
    @Column(length = 255, nullable = true)
    @Comment("varchar(255) NULL DEFAULT NULL COMMENT '工单号'")
    private String workOrderNum;

    /** 工单状态 */
    @Enumerated(EnumType.STRING)
    @NotNull(message = "工单状态不能为空")
    @Comment("varchar(255) NOT NULL COMMENT '工单状态'")
    private WorkOrderStatus status = WorkOrderStatus.temporary;
}
